layui.use(["element",'laydate','form','layer'], function () {
  var element = layui.element;
  var laydate = layui.laydate;
  var form = layui.form;
  var layer = layui.layer;

  laydate.render({
    elem: '.dataTime',
    format:'yyyy-MM-dd'
  });
  form.on('select(AssetClass)', function (data) {
    var caseD = Number(data.value);
    switch (caseD) {
      case 0:
        window.location.href = "ZCLR.html";
        break;
      case 1:
        window.location.href = "ZCLR_FB.html";
        break;
      case 2:
        window.location.href = "ZCLR_ZQ.html";
        break;
      case 3:
        window.location.href = "ZCLR_TYCK.html";
        break;
      case 4:
        window.location.href = "ZCLR_TYCD.html";
        break;
      case 5:
        window.location.href = "ZCLR_HG.html";
        break;
    }
  });
});

var vm = new Vue({
  el: '#app',
  data: {
    field1: ["资产名称", "是否我行客户", "资产类别（中类）", "资产类别（方式）"],
    field2: ["资产代码", "资产类别（大类）", "资产类别（小类）", "统计类别"],
    field3: ["客户名称", "合同编号", "行内评级", "重点客户类型", "是否重点授权客户", "四部委标准企业规模等级", "行业类型代码（大类）", "行业类型代码（小类）", "行业信贷政策", "平台类型", "是否两高一剩", "是否保障房", '近三年净利润为负'],
    field4: ["客户编号", "批复编号", "组织机构（社会信用）代码", "总行战略客户标识", "是否差别化授权客户", "行业类型代码（门类）", "行业类型代码（中类）", "企业出资人经济成分", "客户信贷政策", "是否属于重点监管行业和领域", "是否城乡一体化", "近三年净现金流为负"],
    field5: ["债券名称", "币种", "起息日", "发行价格（元）", "发行面额（万元）"],
    field6: ["债券代码", "发行日期", "到期日", "发行方式", "债券面值（元）"],
    AssetClass: 2, //0:请选择  1:非标准化债权类资产 ,2:债券,3:同业存款,4:同业存单,5:回购
    disabled: true,
    ruleForm1: {
      field0: '债券资产A2',
      field1: '1',
      field2: '8',
      field3: '1'
    },
    ruleForm2: {
      field0: 'ZQ12345678-A2',
      field2: 1,
      field3: 0
    },
    ruleForm3: {
      field0: '企业A',
      field1: '',
      field2: '6级',
      field3: '0',
      field4: '否',
      field5: '中型',
      field6: 0,
      field7: 0,
      field8: '选择支持行业',
      field9: '非政府融资平台客户',
      field10: 2,
      field11: 2,
      field12: 2
    },
    ruleForm4: {
      field0: 'A12345678',
      field1: '',
      field2: 'A12345678',
      field3: '其他客户',
      field4: '是',
      field5: '1',
      field6: '1',
      field7: '国有绝对控股',
      field8: '审慎支持',
      field9: '非政府融资平台客户',
      field10: '2',
      field11: '2',
      field12: 1
    },
    ruleForm5: {
      field0: '企业A',
      field1: '1',
      field2: '2018-11-16',
      field3: '100',
      field4: '2,000,000',
      field5: 'AAA'
    },
    ruleForm6: {
      field0: 'ZQ12345678-A2',
      field1: '2018-11-16',
      field2: '2021-11-15',
      field3: '附息',
      field4: '100',
      field5: '中国建设银行'
    }
  },
  mounted:function(){
    this.init()
  },
  methods: {
    init: function () {
      localStorage.setItem('navigation','<a href="#">首页</a><span lay-separator="">/</span><a href="">大类资产配置模型</a><span lay-separator="">/</span><a><cite>资产录入</cite></a>');
    },
    submitForm: function () {
      var startTime=Date.parse(new Date($("#date2").val()));
      var endTime=Date.parse(new Date($("#date3").val()));
      var year = (endTime-startTime)/1000/3600/24/365;
      if(0<year&&year<=7){
        layer.confirm('操作成功！', {
          icon: 1,
          title: '提示',
          shade: false,
          btnAlign: 'c',
          btn: ['继续录入', '查看详情']
        }, function () {
          window.location.href = 'ZCLR.html';
        }, function () {
          window.location.href = 'ZCLR_ZQ_XQ.html';
        });
      }
      else{
        layer.alert('期限要在7年内！', {
          icon: 2,
          btnAlign: 'c',
          shade: false
        })
      }
    },
    backEdit: function () {
      window.location.href = "ZCLR_ZQ.html";
    },
    goBack: function () {
      window.location.href = "KTZZCQD.html";
    }
  }
})